package com.hcrazy.manchester.app.services;

import java.util.List;

import com.hcrazy.manchester.app.jdbc.LiveBallDAO;
import com.hcrazy.manchester.app.pojo.ErrorMsg;
import com.hcrazy.manchester.app.pojo.LiveAddress;
import com.hcrazy.manchester.app.pojo.LiveBall;
import com.hcrazy.manchester.app.pojo.PageModel;
import com.hcrazy.manchester.app.utils.Constant;

public class LiveBallService {

	private LiveBallDAO liveBallDAO;
	
	public LiveBallDAO getLiveBallDAO() {
		return liveBallDAO;
	}

	public void setLiveBallDAO(LiveBallDAO liveBallDAO) {
		this.liveBallDAO = liveBallDAO;
	}

	public ErrorMsg addOrUpdateLiveBall(LiveBall ball) throws Exception{
		ErrorMsg msg = new ErrorMsg();
		msg.setCode(Constant.SUCCESS);//success
		if(ball.getInfoId()>0){
			liveBallDAO.updateLiveBall(ball);
		}else{
			liveBallDAO.addLiveBall(ball);
		}
		
		return msg;
	}
	
	public PageModel getBallInfos(PageModel model,String search,int sortId) throws Exception{
		return liveBallDAO.getPagedInfos(model, search, sortId);
	}
	
	public LiveBall getInfoById(int infoId) throws Exception{
		return liveBallDAO.getById(infoId);
	}
	
	public void delLiveBall(int infoId) throws Exception{
		liveBallDAO.delLiveBall(infoId);
	}
}
